<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
            "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
    <head>
        <title>Controller Example</title>
        <style type='text/css'>
            body {font-family: verdana}
            .tabs {
                
                padding: 0px; margin: 0px;
            }
            .tabs li {
                float: left;
                padding: 10px;
                background-color: #F6F6F6;
                list-style: none;
                margin-left: 10px;
            }
            .tabs li a {
                color: #1C94C4;
                font-weight: bold;
                text-decoration: none;
            }
            .tabs li.active a {
                color: #F6A828;
                cursor: default;
            }
            .tab {
                border: solid 1px #F6A828;
            }
            /* clearfix from jQueryUI */
            .ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
            .ui-helper-clearfix { display: inline-block; }
            /* required comment for clearfix to work in Opera \*/
            * html .ui-helper-clearfix { height:1%; }
            .ui-helper-clearfix { display:block; }
            /* end clearfix */
        </style>
    </head>
    <body>
<div id="demo-html">
<ul id='tabs' class='ui-helper-clearfix''>
  <li><a href='#tab1'>Tab 1</a></li>
  <li><a href='#tab2'>Tab 2</a></li>
  <li><a href='#tab3'>Tab 3</a></li>
</ul>
<div id='tab1' class='tab'>Tab 1 Content</div>
<div id='tab2' class='tab'>Tab 2 Content</div>
<div id='tab3' class='tab'>Tab 3 Content</div>
</div>
<script type='text/javascript' src='../../steal/steal.js'></script>
<script type='text/javascript'>
steal("jquery/controller", function(){
// create a new Tabs class
$.Controller("Tabs",{
  
  // initialize widget
  init : function(el){
    
    // activate the first tab
    $(el).children("li:first").addClass('active')
    
    // hide the other tabs
    var tab = this.tab;
    this.element.children("li:gt(0)").each(function(){
      tab($(this)).hide()
    })
  },
  
  // helper function finds the tab for a given li
  tab : function(li){
    return $(li.find("a").attr("href"))
  },
  
  // hides old active tab, shows new one
  "li click" : function(el, ev){
    ev.preventDefault();
    this.tab(this.find('.active').removeClass('active')).hide()
    this.tab(el.addClass('active')).show();
  }
})
  
// adds the controller to the element
$("#tabs").tabs();
})
</script>
    </body>
</html>